package com.ruoyi.market.service.impl;

import com.ruoyi.market.domain.Wallet;
import com.ruoyi.market.mapper.WalletMapper;
import com.ruoyi.market.service.IWalletService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.validation.Validator;
import java.util.List;

/**
 * 钱包充值金额配置 业务层处理
 * 
 * @author ruoyi
 */
@Service
public class WalletServiceImpl implements IWalletService
{

    @Autowired
    private WalletMapper walletMapper;

    @Autowired
    protected Validator validator;

    /**
     * 根据条件分页查询钱包充值金额配置列表
     * 
     * @param wallet 钱包充值金额配置信息
     * @return 钱包充值金额配置信息集合信息
     */
    @Override
    public List<Wallet> selectWalletList(Wallet wallet)
    {
        return walletMapper.selectWalletList(wallet);
    }

    /**
     * 通过钱包充值金额配置ID查询钱包充值金额配置
     * 
     * @param walletId 钱包充值金额配置ID
     * @return 钱包充值金额配置对象信息
     */
    @Override
    public Wallet selectWalletById(Long walletId)
    {
        return walletMapper.selectWalletById(walletId);
    }

    /**
     * 新增保存钱包充值金额配置信息
     * 
     * @param wallet 钱包充值金额配置信息
     * @return 结果
     */
    @Override
    @Transactional
    public int insertWallet(Wallet wallet)
    {
        // 新增钱包充值金额配置信息
        int rows = walletMapper.insertWallet(wallet);
        return rows;
    }

    /**
     * 修改保存钱包充值金额配置信息
     * 
     * @param wallet 钱包充值金额配置信息
     * @return 结果
     */
    @Override
    @Transactional
    public int updateWallet(Wallet wallet)
    {
        return walletMapper.updateWallet(wallet);
    }

    /**
     * 修改钱包充值金额配置状态
     * 
     * @param wallet 钱包充值金额配置信息
     * @return 结果
     */
    @Override
    public int updateWalletStatus(Wallet wallet)
    {
        return walletMapper.updateWallet(wallet);
    }

    /**
     * 批量删除钱包充值金额配置信息
     * 
     * @param walletIds 需要删除的钱包充值金额配置ID
     * @return 结果
     */
    @Override
    @Transactional
    public int deleteWalletByIds(Long[] walletIds) { return walletMapper.deleteWalletByIds(walletIds); }
}
